package com.goodfox.web.generic.provide.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.goodfox.web.generic.attribute.service.AttributeService;
import com.goodfox.web.generic.provide.util.AttributeUtil;

/**
 * web参数初始化Servlet
 * @author qin gt
 *
 */
public class WebParasServlet extends HttpServlet {
	
	/** 日志写入器 */
	private Logger logger=Logger.getLogger(WebParasServlet.class);
	
	public ApplicationContext getApplicationContext(){ 
        return WebApplicationContextUtils.getWebApplicationContext(this.getServletContext()); 
    } 
	
	public void init() throws ServletException{
		//填充属性列表
		try{
			AttributeService attributeService=(AttributeService)getApplicationContext().getBean("attributeService");
			attributeService.reloadAttributeList();
		}catch(Exception ex){
			logger.error("加载属性列表异常",ex);
		}
	}
	
}
